﻿using Abp.Application.Services.Dto;
using Abp.Web.Mvc.Authorization;
using Akso.Authorization;
using Akso.Orders;
using Akso.Web.Areas.StudentModule.Models.Orders;
using Akso.Web.Controllers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
namespace Akso.Web.Areas.StudentModule.Controllers
{
    [AbpMvcAuthorize(AppPermissions.Pages_StudentModule_Orders)]
    public class OrdersController : AbpZeroTemplateControllerBase
    {
        private readonly IOrderAppService _ordersAppService;
        public OrdersController(IOrderAppService ordersAppService)
        {
            _ordersAppService = ordersAppService;
        }
        public ActionResult Index()
        {
            var model = new OrdersViewModel
            {
                FilterText = Request.QueryString["filterText"],
            };
            return View(model);
        }
        public ActionResult _OrderInfoModal()
        {
            
            return View();
        }

        public async Task<PartialViewResult> OrderInfoModal(Guid? id)
        {
            var output = await _ordersAppService.GetObjectForEdit(new NullableIdDto<Guid> { Id = id });
            var viewModel = new OrderInfoViewModel(output);

            return PartialView("_OrderInfoModal", viewModel);
        }
    }
}